package com.mud.mudcommune.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.mud.mudcommune.view.fragment.threeLevel.DesignWorkFragment;
import com.mud.mudcommune.view.fragment.threeLevel.EvaluateFragment;
import com.mud.mudcommune.view.fragment.threeLevel.SelfIntroductionFragment;

/**
 * Created by zhoujin on 2016/12/12.
 */

public class ChiefPagerAdapter extends FragmentPagerAdapter {
    private String[] tabs;
    private Fragment selfIntroduction, designWork, evaluate;

    public ChiefPagerAdapter(FragmentManager fm, String[] tabs) {
        super(fm);
        this.tabs = tabs;
    }

    @Override
    public int getCount() {
        return tabs.length;
    }

    @Override
    public Fragment getItem(int position) {
        Fragment fragment = null;
        switch (position) {
            case 0:
                selfIntroduction = SelfIntroductionFragment.getInstance();
                fragment = selfIntroduction;
                break;
            case 1:
                designWork = DesignWorkFragment.getInstance();
                fragment = designWork;
                break;
            case 2:
                evaluate = EvaluateFragment.getInstance();
                fragment = evaluate;
                break;
        }
        return fragment;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabs[position];
    }
}
